import { createBrowserRouter } from "react-router";
import App from "@/App";
import Login from "@/pages/login/Login";
import Layout from "@/pages/layout/Layout";
import Home from "@/pages/home/Home";
import AccountList from "@/pages/account/List";
import AccountAdd from "@/pages/account/Add";
import AccountCenter from "@/pages/account/Center";
import AccountEdit from "@/pages/account/Edit";
import GoodsAdd from "@/pages/goods/Add";
import GoodsList from "@/pages/goods/List";
import GoodsType from "@/pages/goods/Type";
import Order from "@/pages/order/Order";
import Info from "@/pages/permission/Info";
import Role from "@/pages/permission/Role";
import shop from "@/pages/shop/shop";
import StatisticsGoods from "@/pages/statistics/Goods";
import StatisticsOrder from "@/pages/statistics/Order";
const router = createBrowserRouter([
    {
        // 根路由
        path: "/",
        Component: App,
        children: [
            {
                path: "login",
                Component: Login
            },
            // 首页
            {
                path: "home",
                Component: Layout,
                children: [
                    {
                        index: true,
                        Component: Home
                    }
                ]

            },
            // 账号管理
            {
                path: 'account',
                Component: Layout,

                children: [
                    {

                        path: "list",
                        Component: AccountList
                    },
                    {
                        path: 'add',
                        Component: AccountAdd
                    },
                    {
                        path: 'center',
                        Component: AccountCenter
                    },
                    {
                        path: 'edit',
                        Component: AccountEdit
                    }
                ]
            },
            // 商品管理
            {
                path: 'goods',
                Component: Layout,
                children: [
                    {
                        path: 'add',
                        Component: GoodsAdd
                    },
                    {
                        path: 'list',
                        Component: GoodsList
                    },
                    {
                        path: 'type',
                        Component: GoodsType
                    }
                ]
            },
           //店铺管理
           {
                path: 'shop',
                Component: Layout,
                children: [
                    {
                        path: 'shop',
                        Component: shop
                    }
                ]
            },
            // 订单管理
            {
                path: 'order',
                Component: Layout,
                children: [
                    {
                        path: 'order',
                        Component: Order
                    }
                ]
            },
            // 权限管理
            {
                path: 'permission',
                Component: Layout,
                children:[
                    {
                        path: 'info',
                        Component: Info
                    },
                    {
                        path: 'role',
                        Component: Role
                    }
                ]
            },
            // 统计管理
            {
                path: 'statistics',
                Component: Layout,
                children:[
                    {
                        path: 'goods',
                        Component: StatisticsGoods
                    },
                    {
                        path: 'order',
                        Component: StatisticsOrder
                    }
                ]
            }
        ]
    }
])

export default router;